<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.jackysoft.com/jsp/jx" prefix="jx" %>
<%@ taglib uri="http://www.joda.org/joda/time/tags" prefix="joda" %>
<table class="table table-bordered table-hover table-condensed">
	<caption>原始生产计划</caption>
	<thead>
		<tr>
			<th colspan="8">
				<ul id="messages"></ul>
			</th>
		</tr>
		<tr>
			<th width="15%" scope="col">
				代码
			</th>
			<th width="15%" scope="col">
				名称
			</th>
			<th width="6%" scope="col">
				单位
			</th>		
			<th>加工工艺</th>
			<th width="15%" scope="col">
				基础数量
			</th>
			<th>
			       最终量
			</th>
			<th>
			       修改量
			</th>
			<th width="15%" scope="col">
				备注
			</th>
			<th class="line4" width="2%" scope="col">
				删
			</th>
		</tr>		
	</thead>
	<tbody>
		<c:forEach items="${bean.proterozoic}" var="item" varStatus="vs">
			<tr class="${empty item.technics?"":"success"}">
				<td><input name="bean.dataItems[${gindex}].id" type="hidden"
					value="${item.id}" /> <input
					name="bean.dataItems[${gindex}].itemType" type="hidden"
					value="${item.itemType}" /> <!-- 
       <input name="bean.dataItems[${gindex}].host.code" type="hidden" value="${item.host.code}"/>      
        --> <input name="bean.dataItems[${gindex}].owner.code"
					value="${item.owner.code}" readOnly="readonly" /></td>

				<td><input name="bean.dataItems[${gindex}].owner.name"
					value="${item.owner.name}" readOnly /></td>

				<td><input class="price-unit" name="bean.dataItems[${gindex}].owner.priceUnit"
					value="${item.owner.priceUnit}"
					readOnly /></td>
                <td>
                
                <c:if test="${item.technics!=null}">
                	<input type="hidden" name="bean.dataItems[${gindex}].technics.id" value="${item.technics.id}" />
                	<span class="label label-inverse">${item.technics.name}</span>
                </c:if>
                                 
                </td>
				<td>
				<input name="bean.dataItems[${gindex}].value" 
				value="<fmt:formatNumber value="${item.value}" 
				pattern="${numberpat}" />" readOnly />  					
					</td>

				<td>
				<span class="badge badge-important">${item.finalValue}</span>
				
				</td>

				<td>
				 <div class="input-prepend">
				    
                     <div class="btn-group">
                        <c:set var="btnclass" value="${fn:length(item.modifies)==0?'btn-success':'btn-danger' }"  />						
						<button type="button" data-toggle="dropdown"
							class="btn  ${btnclass} dropdown-toggle">
							<span class="caret"></span>
						</button>
						<ul class="dropdown-menu">
							<c:set var="mdfc" value="0" />
							<c:forEach items="${item.modifies}" var="mdf" varStatus="vs">
								<c:set var="mdfc" value="${mdfc+mdf.value}" />
								<li><a href="javascript:;">
								         <span class="label label-warning"> ${mdf.value}</span>
								        -
								        <joda:format value="${mdf.updateDate}" pattern="yyyy-MM-dd hh:mm:ss" />
									    -
									    <span class="label label-important">${mdf.user.localName}</span> 
								        </a> 	    
						        </li>
							</c:forEach>
							<li><a href="javascript:;">累计修改量:${mdfc}</a></li>
						</ul>
					</div>
					<input name="bean.dataItems[${gindex}].modifiedValue" value="0" />
                 </div>
					</td>

				<td><input name="bean.dataItems[${gindex}].remark" value="${item.remark}" /> </td>

				<td><img src="${sbase}/images/removeme.gif"
					onclick="$(this).parent().parent().remove();" /></td>
			</tr>			
			<c:set var="gindex" value="${gindex+1}" />
		</c:forEach>
	</tbody>
</table>